/**
 * node-http.js 
 */
const http = require("http");
const fs = require("fs");
const path = require("path");


http.createServer((req,res) => {
    let filePath = path.join(__dirname,"1.txt");
    let fileReader = fs.createReadStream(filePath);

    /**
     * 这里的res对象也是可以写入的流
     */
    fileReader.pipe(res);
}).listen(8080)

console.log("server is listening 8080");s